/* eslint-disable prettier/prettier */
/*
包含 n个接口请求函数的模块
*/
import ajax from "./ajax";
import ajax2 from "./ajax2";
// import ConfigTxt from "../../config.txt";

//export * from "./subCompanyApi";
// const urlResult = { ConfigTxt };
// const BASE_URL =
//       "http://" +
//       urlResult.ConfigTxt.split(",")[0] +
//       ":" +
//       urlResult.ConfigTxt.split(",")[1];
// const BASE_URL2 =
//       "http://" +
//       urlResult.ConfigTxt.split(",")[0] +
//       ":" +
//       urlResult.ConfigTxt.split(",")[2];

const BASE_URL = "http://39.107.58.183:5071";
const BASE_URL2 = "http://39.107.58.183:5000";
const BASE_URL3 = "http://39.107.58.183:8500";

/**
 * 用户认证（获取token）
 * @param {*} parmas
 */
export const reqAuth = () => {
    sessionStorage.clear();
    return ajax(BASE_URL + "/api/tokens", {}, 'POST');
}

/**
 * 查询测试信息 
 * @param {*} parmas
 */
export const reqSendInfo = params => ajax(BASE_URL + "/test/query", params);

/**
 * 查询开始接口摄像头信息 
 * @param {*} parmas
 */
export const reqCameraNum = params => ajax(BASE_URL + "/test/getCameraNumsOnline", params);

/**
 * 查询停止接口和云台控制接口流信息（camerNum、videoType） 
 * @param {*} parmas
 */
export const reqStreams = params => ajax(BASE_URL + "/test/getStreams", params);


/**
 * 查询token信息 
 * @param {*} parmas
 */
export const reqTokenNum = params => ajax(BASE_URL + "/test/getPlatformCurToken", params);

/**
 * 修改token信息 
 * @param {*} parmas
 */
export const reqUpdateTokenNum = params => ajax(BASE_URL + "/test/updatePlatformCurToken", params,"POST");

/**
 * 注册/修改厂商信息
 * @param {*} parmas
 */
export const reqRegistDeviceUsers = params => ajax(BASE_URL + "/test/registerDevice", params,"POST");


/**
 * 获取厂商信息
 * @param {*} parmas
 */
export const reqDeviceUsersInfo = params => ajax(BASE_URL + "/test/getDeviceInfo", params);

/**
 * 查询厂商列表 
 * @param {*} parmas
 */
export const reqDeviceUsers = params => ajax(BASE_URL + "/test/getDeviceUsers", params);

/**
 * 查询平台配置信息
 * @param {*} parmas
 */
export const reqPlatformInfo = params => ajax(BASE_URL + "/test/getPlatformInfo", params);


/**
 * 修改平台配置信息
 * @param {*} parmas
 */
export const reqChangePlatformInfo = params => ajax(BASE_URL + "/test/configPlatformInfo", params,"POST");

/**
 * 查询厂商camerNums列表 
 * @param {*} parmas
 */
export const reqUserPlayCamerNums = params => ajax(BASE_URL + "/test/getCameraNumsOnline", params);

/**
 * 请求获得在线camerId 
 * @param {*} parmas
 */
export const reqOnlineStreamId = params => ajax(BASE_URL3 + "/media/stream/query", params,"POST");

/**
 * 请求获得对应在线camerId的url流播放地址 
 * @param {*} parmas
 */
export const reqStreamUrlById = params => ajax(BASE_URL3 + "/media/playstream/url", params,"POST");

/**
 * 请求插入流媒体地址 
 * @param {*} parmas
 */
export const reqAddUrlInfo = params => ajax(BASE_URL2 + "/url/add", params,"POST");

/**
 * 重载测试用例
 * @param {*} parmas
 */
export const reqReloadUrlInfo = params => ajax(BASE_URL2 + "/url/reload", params);

/**
 * 清空测试用例
 * @param {*} parmas
 */
export const reqEmptyUrlInfo = params => ajax(BASE_URL2 + "/url/clear", params);

/**
 * 获取测试用例列表
 * @param {*} parmas
 */
export const reqTestItemInfo = params => ajax(BASE_URL2 + "/url/query", params);

/**
 * 开始测试用例
 * @param {*} parmas
 */
export const reqStartTest = params => ajax(BASE_URL2 + "/url/test/start", params);

/**
 * 获取测试结果列表
 * @param {*} parmas
 */
export const reqTestResultInfo = params => ajax(BASE_URL2 + "/url/test/query", params);


/**
 * 获取厂商任务列表
 * @param {*} parmas
 */
export const reqTaskInfo = params => ajax(BASE_URL + "/test/getTaskInfo", params);

/**
 * 获取监控任务结束后最终的分析结果
 * @param {*} parmas
 */
export const reqMonitorResultInfo = params => ajax2(BASE_URL3 + "/media/monitor/analyse", params,'POST');


/**
 * 查询源记录数据信息
 * @param {*} parmas
 */
export const reqMonitorRecordInfo = params => ajax2(BASE_URL3 + "/media/record/query", params,'POST');

/**
 * 查询摄像头状态
 * @param {*} parmas
 */
export const reqCameraStatus = params => ajax2(BASE_URL + "/test/refreshCameraStatus", params,'GET');

/**
 * 开始推流
 * @param {*} parmas
 */
export const reqStreamStart = (params,company) => ajax(BASE_URL + `/test/query?queryType=6&username=${company}`, params,'POST');

/**
 * 停止推流
 * @param {*} parmas
 */
export const reqStreamFinish = (params, company) => ajax(BASE_URL + `/test/query?queryType=7&username=${company}`, params, 'POST');

/**
 * 云台控制
 * @param {*} parmas
 */
export const reqPtzControl = (params, company) => ajax(BASE_URL + `/test/query?queryType=8&username=${company}`, params, 'POST');


/**
 * 批量推流
 * @param {*} parmas
 */
export const reqPushStream = (params,company) => ajax2(BASE_URL + `/test/query?queryType=9&username=${company}`, params,'POST');

/**
 * 批量停止
 * @param {*} parmas
 */
export const reqStopStream = (params,company) => ajax2(BASE_URL + `/test/query?queryType=10&username=${company}`, params,'POST');
